using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using SCS.Common.Models;
namespace SCS.DAL.Mapping
{
    public class CommonCommentMap : EntityTypeConfiguration<CommonComment>
    {
        public CommonCommentMap()
        {
            // Primary Key
            this.HasKey(t => t.comCommentID);

            // Properties
            this.Property(t => t.commonComment1)
                .IsRequired()
                .HasMaxLength(250);

            // Table & Column Mappings
            this.ToTable("CommonComment");
            this.Property(t => t.comCommentID).HasColumnName("comCommentID");
            this.Property(t => t.dateOfComment).HasColumnName("dateOfComment");
            this.Property(t => t.classID).HasColumnName("classID");
            this.Property(t => t.commonComment1).HasColumnName("commonComment");
            this.Property(t => t.isSent).HasColumnName("isSent");

            // Relationships
            this.HasRequired(t => t.Class)
                .WithMany(t => t.CommonComments)
                .HasForeignKey(d => d.classID);

        }
    }
}
